﻿using OF.Component.Base;
using OF.Component.BLL;
using OF.Component.Model;
using OF.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace OP.manage.shop
{
    public partial class shopdetail : OpBasePage
    {
        public int Id
        {
            get
            {
                return EConvert.ToInt(Request.QueryString["id"]);
            }
        }

        public ShopInfo oInfo = new ShopInfo();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                oInfo = ShopOperate.GetByID(Id);
                oInfo.HeadImgSrc = AppSettings.UploadFileFullHttpDir + oInfo.HeadImgSrc;
                GetShopImageById();
            }
        }

        protected string GetLocationInfoById(int lId)
        {
            BaseLocation_AllInfo info = BaseLocation_AllOperate.GetByID(lId);
            if (info!=null)
            {
                return string.Format("{0}{1}", info.PName, info.CName);
            }
            return "";
        }

        protected void GetShopImageById()
        {
            IList<ShopImgInfo> list = ShopImgOperate.QueryList(a => a.ShopID == Id);
            list.ForEach(a => {
                a.ImgUrl = AppSettings.UploadFileFullHttpDir + a.ImgUrl;
            });
            this.rptDataList.DataSource = list;
            this.rptDataList.DataBind();
        }
    }
}